import Mock from 'mockjs';
import {resultSuccess} from '../_util';

const Random = Mock.Random;

const token = Random.string('upper', 32, 32);

const adminInfo = {
  id: 27,
  telephone: "13718246680",
  name: "赵聃",
  dept: "未来景区部",
  apiToken: token,
  token: "YiPkIYARUDhPBkImijxDkNpEpeZqsZoD",
  valid: 1,
  knowledge_status: 1,
}

const permissions = [
  {
    label: '工作台',
    value: 'dashboard_workplace',
  },
  {
    label: '基础列表',
    value: 'basic_list',
  },
  {
    label: '基础列表删除',
    value: 'basic_list_delete',
  },
];

export default [
  {
    url: '/api/login',
    timeout: 1000,
    method: 'post',
    response: () => {
      return resultSuccess({...adminInfo});
    },
  },
  {
    url: '/api/permissions',
    timeout: 1000,
    method: 'get',
    response: () => {
      // const token = getRequestToken(request);
      // if (!token) return resultError('Invalid token');
      return resultSuccess(permissions);
    },
  },
];
